<template>
	<view>
		<u-navbar titleStyle="font-size:40rpx;color:#333" :placeholder='true' title="全部商品" :autoBack="true">
		</u-navbar>
		<!-- 收藏时间 -->
		<view class="relative" style="z-index: 999;border-radius: 0 0 40rpx 40rpx;"
			:style="list2Active==3 && showModel?'overflow: hidden':''">
			<view class="time   padding32">
				<view class="flexJBC paddingLR32">
					<view class="flex" v-for="(item,index) in List2" @click="list2ActiveClick(index)"
						:class="list2Active==index?'':'co9'">
						<view class="">
							{{item.name}}
						</view>
						<view class="flexcenter" v-if="index==2">
							<u-icon name="arrow-up-fill" size="10rpx" color="#333"></u-icon>
							<u-icon name="arrow-down-fill" size="10rpx" style='margin-top: 8rpx;' color="#333">
							</u-icon>
						</view>
						<image v-if="index==3" src="/static/images/search/shaixuan.png"
							style="width: 22rpx;height: 22rpx;"></image>
					</view>
				</view>
				<view class="mt24" v-if="list2Active==3 && showModel">
					<view class="flexJBC padding32">
						<u-input type='number' inputAlign='center'
							customStyle="width:248rpx;background: #F5F5F5;height:72rpx;" placeholder="自定最低价"
							border="none" v-model="minPrice"></u-input>
						<view class="" style="margin: 0 14rpx;color:#ccc">
							——
						</view>
						<u-input type='number' inputAlign='center'
							customStyle="width:248rpx;background: #F5F5F5;height:72rpx;" placeholder="自定最高价"
							border="none" v-model="maxPrice"></u-input>
					</view>
					<view class=" flexJBC" style="padding:20rpx 100rpx  0">
						<view class="btnClick1 co9" style="border-color: #999;">
							重置
						</view>
						<view class="btnClick1 borderred homeRed">
							确认
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="paddingLR32">
			<List :showTopTitle="false" :list='list' v-if="list.length>0"/>
		</view>
		<!-- 黑框 -->
		<view class="model" v-if="list2Active==3 && showModel" @click="showModel=false"></view>
	</view>
</template>
<script>
	import List from '@/componentes/list.vue'
	export default {
		components: {
			List
		},
		data() {
			return {
				store_id:1,
				showModel: false,
				minPrice: '', //筛选最小得价格
				maxPrice: '', //筛选最大得价格
				page: 1,
				list: [], //数据列表
				list2Active: 3,
				List2: [{
					name: '综合推荐',
				}, {
					name: '销量',
				}, {
					name: '价格'
				}, {
					name: '筛选'
				}],

			}
		},
		methods: {
			list2ActiveClick(index) {
				this.list2Active = index
				if (index == 3) {
					this.showModel = true
				}
			},
			getList() {
				this.$my.post('/index/Product/getFactoryProduct', {
					limit: 10,
					page: this.page,
					store_id: this.store_id
				}).then(res => {
					if (res.code == 200) {
						if (this.page == 1) {
							this.list = res.data.data
						}else {
							this.list = this.list.concat(res.data.data)
						}
					}
					console.log(this.list)
				})
			},
		},
		onLoad(option) {
			this.store_id=option.store_id?option.store_id:1;
			this.getList();
		},
		onReachBottom() {
			this.page++;
			this.getList()
		},
	}
</script>

<style lang="scss" scoped>
	.nodeta {
		position: fixed;
		top: 50%;
		left: 50%;
		transform: translateX(-50%) translateY(-50%);
	}

	.model {
		width: 100%;
		height: 100vh;
		position: fixed;
		top: 0%;
		left: 0%;
		background-color: rgba(0, 0, 0, .6);
	}

	.timelis {
		width: 30%;
		text-align: center;
		background-color: #f5f5f5;
		font-size: 24;
		height: 72rpx;
		line-height: 72rpx;
		border-radius: 8rpx;
		margin-right: 28rpx;
	}

	.timelis:nth-of-type(3) {
		margin-right: 0;
	}

	// .timelis:[2n+1]{
	// 	margin: 0 10%;
	// }
	.time {
		background-color: #fff;
	}

	.toprightBox {
		padding: 24rpx;
		box-sizing: border-box;
		width: 276rpx;
		// height:281rpx;
		// left: 216px;
		right: 32rpx;
		top: 82rpx;
		background: #fff;
		box-shadow: 0px 0px 8rpx 4rpx rgba(171, 171, 171, 0.25);
		z-index: 10;
	}

	.bottomBox {
		width: 100%;
		height: 112rpx;
		background-color: #fff;
		position: fixed;
		bottom: 0;
	}

	.lis {
		background-color: #fff;
		padding-bottom: 24rpx;
		// box-sizing: border-box;

		.like {
			padding: 0rpx 10rpx;
			height: 48rpx;
			line-height: 48rpx;
			border-radius: 24rpx;
			background-color: #f5f5f5;
		}

		.lisRight {
			// display: flex;
			// flex-direction: column;
			// justify-content: space-between;
			flex: 1;
			margin-left: 30rpx;
			// height: 240rpx; 
			margin-right: 38rpx;
		}
	}

	.li {
		padding: 0 52rpx;
		box-sizing: border-box;
		height: 60rpx;
		line-height: 60rpx;
		border-radius: 30rpx;
		margin-bottom: 40rpx;
	}

	.active {
		background-color: $red;
		color: #fff;
		box-shadow: 0rpx 5rpx 8rpx 1rpx rgba(255, 111, 111, 0.25);
	}
</style>
